package com.ly.cyclictest.test01;

import java.util.concurrent.CyclicBarrier;

public class CyclicMain {
    public static void main(String[] args) {
        //创建一个
        CyclicBarrier cyclicBarrier = new CyclicBarrier(5,new BarrierRun(10));
        for (int i =0 ; i<5 ;i++){
            System.out.println("士兵"+(i+1)+"报道");
            Thread thread = new Thread(new Soldier("士兵" + (i+1), cyclicBarrier));
            thread.start();
        }
    }
}
